import oauth2AdminApiConfig from '@/core/oauth2/generated/apiconfig/oauth2AdminApiConfig'
import serverApiMockUtils from '../../utils/serverApiMockUtils'
import mockProdServerUtils from '../../utils/mockUtils'
import { MockMethod } from 'vite-plugin-mock'
import Mock from 'mockjs'
import Oauth2AuthorizationResponse from '@/core/oauth2/generated/types/model/response/Oauth2AuthorizationResponse'

const content: Oauth2AuthorizationResponse[] = []
for (let i = 0; i < 10; i++) {
	content.push({
		id: i.toString(),
		registeredClientId: i.toString(),
		principalName: `principalName_客户端认证的令牌_${i.toString()}`,
		authorizationGrantType: `authorizationGrantType_客户端认证的令牌_${i.toString()}`,
		authorizationScopes: Mock.Random.integer(1, 2) == 1 ? null : `authorizationScopes_客户端认证的令牌_${i.toString()}`,
		attributes: Mock.Random.integer(1, 2) == 1 ? null : `attributes_客户端认证的令牌_${i.toString()}`,
		state: Mock.Random.integer(1, 2) == 1 ? null : `state_客户端认证的令牌_${i.toString()}`,
		authorizationCodeValue: Mock.Random.integer(1, 2) == 1 ? null : `authorizationCodeValue_客户端认证的令牌_${i.toString()}`,
		authorizationCodeIssuedAt:
			Mock.Random.integer(1, 2) == 1 ? null : `authorizationCodeIssuedAt_客户端认证的令牌_${i.toString()}`,
		authorizationCodeExpiresAt:
			Mock.Random.integer(1, 2) == 1 ? null : `authorizationCodeExpiresAt_客户端认证的令牌_${i.toString()}`,
		authorizationCodeMetadata:
			Mock.Random.integer(1, 2) == 1 ? null : `authorizationCodeMetadata_客户端认证的令牌_${i.toString()}`,
		accessTokenValue: Mock.Random.integer(1, 2) == 1 ? null : `accessTokenValue_客户端认证的令牌_${i.toString()}`,
		accessTokenIssuedAt: Mock.Random.integer(1, 2) == 1 ? null : `accessTokenIssuedAt_客户端认证的令牌_${i.toString()}`,
		accessTokenExpiresAt: Mock.Random.integer(1, 2) == 1 ? null : `accessTokenExpiresAt_客户端认证的令牌_${i.toString()}`,
		accessTokenMetadata: Mock.Random.integer(1, 2) == 1 ? null : `accessTokenMetadata_客户端认证的令牌_${i.toString()}`,
		accessTokenType: Mock.Random.integer(1, 2) == 1 ? null : `accessTokenType_客户端认证的令牌_${i.toString()}`,
		accessTokenScopes: Mock.Random.integer(1, 2) == 1 ? null : `accessTokenScopes_客户端认证的令牌_${i.toString()}`,
		oidcIdTokenValue: Mock.Random.integer(1, 2) == 1 ? null : i.toString(),
		oidcIdTokenIssuedAt: Mock.Random.integer(1, 2) == 1 ? null : i.toString(),
		oidcIdTokenExpiresAt: Mock.Random.integer(1, 2) == 1 ? null : i.toString(),
		oidcIdTokenMetadata: Mock.Random.integer(1, 2) == 1 ? null : i.toString(),
		refreshTokenValue: Mock.Random.integer(1, 2) == 1 ? null : `refreshTokenValue_客户端认证的令牌_${i.toString()}`,
		refreshTokenIssuedAt: Mock.Random.integer(1, 2) == 1 ? null : `refreshTokenIssuedAt_客户端认证的令牌_${i.toString()}`,
		refreshTokenExpiresAt: Mock.Random.integer(1, 2) == 1 ? null : `refreshTokenExpiresAt_客户端认证的令牌_${i.toString()}`,
		refreshTokenMetadata: Mock.Random.integer(1, 2) == 1 ? null : `refreshTokenMetadata_客户端认证的令牌_${i.toString()}`,
		deleteFlag: `deleteFlag_客户端认证的令牌_${i.toString()}`,
		createTime: new Date().getTime().toString(),
		updateTime: new Date().getTime().toString(),
		rowVersion: 1,
	} as Oauth2AuthorizationResponse)
}

const mockList: MockMethod[] = [...serverApiMockUtils.getDefaultServerApi(oauth2AdminApiConfig.oauth2Authorization, content)]

mockProdServerUtils.addMockList(...mockList)

export const items = content
